package com.sentinel.ctl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RefreshScope
@RestController
@RequestMapping("timeout")
public class TimeoutCtl {

    @Value("${timeout.millis:10}")
    private int millis;

    @RequestMapping
    public Object timeout() throws InterruptedException {
//        log.info("sleep {} millis", millis);
//        Thread.sleep(millis);
        return "success " + millis + " millis";
    }
}
